package com.tj.collection.db.dao;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.BaseMapper;
import com.tj.collection.db.entity.ClReceiverEntity;
import com.tj.collection.db.entity.business.ClLanguageOrderCountEntity;
import com.tj.collection.db.entity.business.WrongPaidStatusCollectionOrderVo;

import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2019-09-03
 * Time: 10:27
 */
public interface ClReceiverDao extends BaseMapper<ClReceiverEntity> {

    ClReceiverEntity selectLastByBillNo(String billNo);

    ClReceiverEntity selectLastByBillNoAndNotPay(String billNo);

    List<ClReceiverEntity> selectListByBillNo(String billNo);

    ClReceiverEntity selectLastByOrderNo(String orderNo);

    ClReceiverEntity selectByCollectionNo(String collectionNo);

    ClReceiverEntity selectUnsettledByCollectionNo(String collectionNo);

    List<ClReceiverEntity> selectListByUserCode(String userCode);

    void updateOverdueDays();

    List<ClReceiverEntity> selectListByCreateDtAndStatusAndMerchantCode(Date date, Integer status, String merchantCode);

    void updateStatusByCollectionNos(List<String> collectionNos, Integer status);

    Integer updateStatusByBatchNo(String batchNo, Integer status);

    List<ClReceiverEntity> selectByCollectionNos(List<String> collectionNos);

    List<ClReceiverEntity> selectListByBillNos(List<String> billNos);

    List<ClReceiverEntity> selectListByOrderNos(List<String> orderNos);

    List<ClReceiverEntity> selectNotEndListByPage(Integer startIndex, Integer endIndex);

    List<ClReceiverEntity> selectEndListByPageAndOverdueDays(Integer startIndex, Integer endIndex);

    List<WrongPaidStatusCollectionOrderVo> getWrongPaidStatusCollectionOrders();

    /**
     * 查询今日每种语言的待分单数
     *
     * @param merchantCode
     * @param overdueDays
     * @return
     */
    List<ClLanguageOrderCountEntity> selectLanguageOrderCountList(String merchantCode, Integer overdueDays);

    /**
     * 查询今日待分单和已分单的订单数汇总
     *
     * @param merchantCode
     * @param overdueDays
     * @return
     */
    List<ClLanguageOrderCountEntity> selectCumulativeLanguageOrderCountList(String merchantCode, Integer overdueDays, List<Integer> adminIdList);

    List<Integer> selectOverdueDaysListByMerchantCode(String merchantCode);

    /**
     * 根据商户+逾期天数+状态查询订单
     *
     * @param merchantCode
     * @param overdueDays
     * @param userLanguage
     * @param status
     * @param page
     * @return
     */
    List<ClReceiverEntity> selectReceiverListByMerchantCodeAndOverdueDays(String merchantCode, Integer overdueDays, String userLanguage, Integer status, Page page);

    Integer updateReceiverActiveDate(String billNo);
}
